package com.common.retrofit.methods;

import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.entity.bean.GenOrderBean;
import com.common.retrofit.service.HaiNingService;

import rx.Observable;
import rx.Subscriber;

public class GeneOrderMethods extends BaseMethods {

    private static GeneOrderMethods m_ins = null;

    public static GeneOrderMethods getInstance() {
        if (m_ins == null) {
            synchronized (GeneOrderMethods.class) {
                if (m_ins == null) {
                    m_ins = new GeneOrderMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Order/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }


    public void order(Subscriber<GenOrderBean> subscriber,
                      int uid ,
                      String hashid  ,int orderId ,String goods ) {
        Observable observable = initService().order(System.currentTimeMillis()+"",
                "54684763e82793c23ea2d951ff07295b",uid,hashid,orderId, goods
        );
        toSubscribe(observable, subscriber);
    }
}
